﻿<%@ Page Language="C#" MasterPageFile="~/car-insurance/Car_Insurance_Result_new.master"
    AutoEventWireup="true" CodeFile="ChangePassword.aspx.cs" Inherits="User_ChangePassword"
    Title="Change Password" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script src="../includes/ValidationEffect.js" type="text/javascript"></script>

    <script src="../includes/ValidationError.js" type="text/javascript"></script>

    <div class="elements_inner_wrapper">

        <div class="rightcol">
            <div class="content_right">
                <div class="content_right">
                
                <!-- #Include file="../includes/rcol_services.aspx" -->
                <div class="seperator"></div>
                <div class="foot"></div>
                </div>
            </div>
        </div>

        <div id="contentBody">
            <div class="section">
                <asp:Panel ID="pnlChangePassword" runat="server" DefaultButton="btnChangePassword">
                    <fieldset>
                        <h1>Change Password:</h1>
                        <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
                        <div class="row">
                            <asp:ScriptManager ID="ScriptManager1" runat="server">
                            </asp:ScriptManager>
                            <asp:ValidationSummary ID="vsChangeCustomer" runat="server" ValidationGroup="customer"
                                ShowSummary="True" CssClass="errorSummary" HeaderText="Oops please complete the form">
                            </asp:ValidationSummary>
                        </div>
                        <div class="row">
                            <label class="mand_red">
                                Current Password</label>
                            <div class="field">
                                <span class="indicator">
                                    <asp:TextBox ID="txtOldPassword" runat="server" TextMode="Password" MaxLength="20"
                                        Width="150px"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvOldPassword" runat="server" ControlToValidate="txtOldPassword"
                                        validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                        ValidationGroup="customer"></asp:RequiredFieldValidator>
                                </span>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="row">
                            <label class="mand_red">
                                New Password</label>
                            <div class="field">
                                <span class="indicator">
                                    <asp:TextBox ID="txtNewPassword" TextMode="Password" runat="server" MaxLength="20"
                                        Width="150px"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvNewPassword" runat="server" ControlToValidate="txtNewPassword"
                                        validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                        ValidationGroup="customer"></asp:RequiredFieldValidator>
                                </span>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="row">
                            <label class="mand_red">
                                Confirm Password</label>
                            <div class="field">
                                <span class="indicator">
                                    <asp:TextBox ID="txtConfirmPassword" TextMode="Password" runat="server" MaxLength="20"
                                        Width="150px"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvConfirmPassword" runat="server" ControlToValidate="txtConfirmPassword"
                                        validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                        ValidationGroup="customer"></asp:RequiredFieldValidator>
                                    <asp:CompareValidator ID="csvConfirmPassword" runat="server" ControlToCompare="txtNewPassword"
                                        validationErrorCssClass="validationError" ControlToValidate="txtConfirmPassword"
                                        Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:CompareValidator>
                                </span>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="row">
                            <label>
                                Security Check</label>
                            <div class="field">
                                <span class="indicator">
                                    <asp:UpdatePanel runat="server" ID="uplCAPCHA">
                                        <ContentTemplate>
                                            <div style="display: block; float: left;">
                                                <asp:Image ID="imgCAPTCHA" ImageUrl="~/captcha/frmJpegImage.aspx" runat="server" />
                                            </div>
                                            <asp:ImageButton ID="btnNewImage" runat="server" OnClick="btnNewImage_Click" ImageUrl="~/images/icons/refresh.gif"
                                                ToolTip="Reload" AlternateText="Refresh" />
                                            <%--<asp:Label ID="Label1" Text="" runat="server"></asp:Label>--%>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                    <asp:UpdateProgress AssociatedUpdatePanelID="uplCAPCHA" DisplayAfter="100" runat="server"
                                        ID="udpCAPTCHA">
                                        <ProgressTemplate>
                                            <img src="../images/loading7.gif" alt="Loading..." width="30" height="20" /><br />
                                        </ProgressTemplate>
                                    </asp:UpdateProgress>
                                </span>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="row">
                            <label class="mand_red">
                                Text in Box</label>
                            <div class="field">
                                <span class="indicator">
                                    <asp:TextBox ID="txtSecurityCode" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvSecurityCheck" runat="server" ControlToValidate="txtSecurityCode"
                                        validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                        ValidationGroup="customer"></asp:RequiredFieldValidator>
                                </span>
                            </div>
                            <div class="clear">
                            </div>
                        </div>
                        <div class="row">
                            <label>
                            </label>
                            <div class="field">
                                <span class="button2">
                                    <%--<asp:ImageButton ID="btnSubmit" runat="server" OnClientClick="LoadValidationErrorCss();"
                                        OnClick="btnSubmit_Click" Text="Change Password" ValidationGroup="customer" ImageUrl="~/images/buttons/change_password.gif"
                                        onmouseover="this.src='/images/buttons/change_password_o.gif';" onmouseout="this.src='/images/buttons/change_password.gif';">
                                    </asp:ImageButton>--%><asp:Button runat="server" ID="btnChangePassword" CssClass="button_changepassword"
                                        ValidationGroup="customer" OnClientClick="LoadValidationErrorCss(); if (Page_ClientValidate('customer')) {this.className = 'button_w_processing';}"
                                        OnClick="btnChangePassword_Click" />
                                </span>
                            </div>
                        </div>
            </div>
            </fieldset> </asp:Panel>
        </div>
    </div>
    </div>

    <script type="text/javascript">
        function CheckPasswordLength(source, arguments) {
            //var corglen = arguments.Value;
            var cval = arguments.Value;
            var bValid = true;
            var chList = new Array(20);
            var ctrlsource = document.getElementById(source.id);

            //alert("ORG LEN : " + corglen.length + " AFTER : " + cval.length);
            if (cval.indexOf(' ') != -1 || cval.indexOf('\'') != -1
                        || cval.indexOf('\"') != -1 || cval.indexOf('~') != -1) {
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password include invalid character or space!";
                }
                else {
                    ctrlsource.innerText = "Password include invalid character or space!";
                }

                ctrlsource.errormessage = "Password include invalid character or space!";
                bValid = false;
            }
            else if (cval.length < 6) {
                //ctrlsource.innerText = "Password length should be at least 6";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should be at least 6";
                }
                else {
                    ctrlsource.innerText = "Password length should be at least 6";
                }

                ctrlsource.errormessage = "Password length should be at least 6";
                bValid = false;
            }
            else if (cval.length > 20) {
                bValid = false;
                //ctrlsource.innerText = "Password length should not be over 20!";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should not be over 20!";
                }
                else {
                    ctrlsource.innerText = "Password length should not be over 20!";
                }
                ctrlsource.errormessage = "Password length should not be over 20!";
            }
            else {
                bValid = true;
            }
            //alert(cval);
            //if (isNaN(cval)){
            //    bValid = false;
            //} 


            //alert(bValid);
            arguments.IsValid = bValid;
            return;
        }
        
        
    </script>

</asp:Content>
